#include<stdio.h>
int main()
{
    //freopen("in.txt","r",stdin);
    int x[1000];
    int y[1000];
    int score[1000];
    int xf = 0;
    int yf = 0;
    int n;
    int m = 0;
    scanf("%d",&n);
    int k = 1;
    for(int i = 0; i < n; i++)
    {
        k*=2;
    }
    for(int i = 1; i <= k; i++)
    {
        int temp;
        scanf("%d",&temp);
        score[i] = temp;
        x[xf++] = i;
    }
    for(int i = 1; i < n; i++)
    {
        if( m == 0 )
        {
            while (xf > 0)
            {
                int a = x[--xf];
                int b = x[--xf];
                if(score[a] > score[b])
                {
                    y[yf++] = a;
                }
                else
                {
                    y[yf++] = b;
                }
            }
            m = 1;
        }
        else
        {
            while (yf > 0)
            {
                int a = y[--yf];
                int b = y[--yf];
                if(score[a] > score[b])
                {
                    x[xf++] = a;
                }
                else
                {
                    x[xf++] = b;
                }
            }
            m = 0;
        }
    }
    if(m == 0)
    {
        int a = x[--xf];
        int b = x[--xf];
        if(score[a] > score[b])
        {
            printf("%d",b);
        }
        else
        {
            printf("%d",a);
        }
    }
    else
    {
        int a = y[--yf];
        int b = y[--yf];
        if(score[a] > score[b])
        {
            printf("%d",b);
        }
        else
        {
            printf("%d",a);
        }
    }
}